<template>
  <view class="select-goods" @click="selectType">
	<view class="m-select-icon"></view>
    <view class="goods-box">
      <text v-if="!showTxt">要配送的物品类型、重量</text>
      <text class="goods" v-else>{{showTxt}}</text>
    </view>
    <text class="icon-jiantou iconfont"></text>
  </view>
</template>

<script>
var app = getApp()
export default {
  name: 'SelectGoods',
  data () {
    return { }
  },
  props: {
	  showTxt: {
		  type: String,
		  default: ''
	  }
  },
  watch: {
	  showTxt: {
		  immediate: true,
		  handler (val) {
			  console.log('配送的物品类型、重量', val)
		  }
	  }
  },
  mounted () {
	  if (!app) {
		  app = getApp()
	  }
  },
  methods: {
    selectType () {
		if (!app.globalData.is_login) {
			this.$emit('checkLogin')
			return
		}
		uni.navigateTo({
			url: '/pages/runErrands/goodsType'
		})
    }
  }
}
</script>

<style lang="stylus" scoped>
.select-goods
  background #fff
  display flex
  align-items center
  font-size 14px
  color #999
  line-height 1.8
  padding 14px 0
  .goods-box
    margin-left 10px
    flex-grow 1
    .goods
      color #333
	  
.m-select-icon 
	width 50upx
	height 50upx
	background-image url('')
	background-position center
	background-repeat no-repeat
	background-size 50upx
	
</style>
